package com.shreecon.lms.interfaces.manager;

import com.shreecon.lms.interfaces.IMessageConstant;
import com.shreecon.lms.interfaces.LMSException;

/**
 * A factory for creating EmployeeManager objects.
 */
public class EmployeeManagerFactory {
	
	/** The Constant _instance. */
	private static final EmployeeManagerFactory _instance = new EmployeeManagerFactory();
	
	/**
     * Instantiates a new employee manager factory.
     */
	private EmployeeManagerFactory() {
		
	}
	
	/**
     * Gets the single instance of EmployeeManagerFactory.
     * 
     * @return single instance of EmployeeManagerFactory
     */
	public static final EmployeeManagerFactory getInstance() {
		return _instance;
	}
	
	/**
     * Gets the employee manager.
     * 
     * @return the employee manager
     * @throws LMSException
     *             the lMS exception
     */
	public IEmployeeManager getEmployeeManager() throws LMSException {
		try {
			return (IEmployeeManager)Class.forName("com.shreecon.lms.manager.EmployeeManager").newInstance();
		} catch (InstantiationException e) {
			e.printStackTrace();
			throw new LMSException(IMessageConstant.TECH_ERROR, e);
		} catch (IllegalAccessException e) {
			e.printStackTrace();
			throw new LMSException(IMessageConstant.TECH_ERROR, e);
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
			throw new LMSException(IMessageConstant.TECH_ERROR, e);
		}
	}

}
